<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet
	version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns="http://www.w3.org/1999/xhtml">

<xsl:output
	method="xml"
	indent="yes"
	encoding="UTF-8"
	omit-xml-declaration="yes"/>


<xsl:include href="template-game.xsl"/>

<xsl:template name="content" mode="galaxy">
<!-- 	<xsl:param name="id-planet-current"/> -->
	<table>
		<thead>
			<tr>
				<th>Planète</th>
				<th>Coordonnées</th>
				<th>Joueur</th>
			</tr>
		</thead>
		<tfoot>
			<tr>
				<th>Planète</th>
				<th>Coordonnées</th>
				<th>Joueur</th>
			</tr>
		</tfoot>
		<tbody>
			<xsl:variable name="players" select="players"/>
			<xsl:variable name="names-race" select="$names/races/race"/>
			<xsl:for-each select="planets/planet">
				<tr>
					<td>
						<xsl:value-of select="@id"/>
						<xsl:if test="name/text()">
							(<xsl:value-of select="name"/>)
						</xsl:if>
					</td>
					<td>
						<a href="?page=move&amp;target={@id}">
							<xsl:call-template name="coordinates-join">
								<xsl:with-param name="coordinates" select="coordinates"/>
							</xsl:call-template>
						</a>
					</td>
					<td>
						<xsl:variable name="id" select="@id"/>
						<xsl:variable name="player" select="$players/player[@id=$id]"/>
						<xsl:choose>
							<xsl:when test="$player">
								<xsl:variable name="race" select="$player/@race"/>
								[<xsl:value-of select="$player/@id"/>] <xsl:value-of select="$player"/> (<xsl:value-of select="$names-race[@id=$race]"/>)
							</xsl:when>
							<xsl:otherwise>
								Planète inhabitée
								<xsl:attribute name="class">planet-uninhabited</xsl:attribute>
							</xsl:otherwise>
						</xsl:choose>
					</td>
				</tr>
			</xsl:for-each>
		</tbody>
	</table>
</xsl:template>


</xsl:stylesheet>